Skip to content

Conversation

@frederick-vs-ja
Copy link
Contributor

No escape hatch added, as there doesn't seem anyone critically relying on this.

Closes #112856.

No escape hatch added, as there doesn't seem anyone critically relying
on this.
@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner July 9, 2025 07:40
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jul 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-libcxx

Author: A. Jiang (frederick-vs-ja)

Changes

No escape hatch added, as there doesn't seem anyone critically relying on this.

Closes #112856.


Full diff: https://github.com/llvm/llvm-project/pull/147671.diff

4 Files Affected:

  • (modified) libcxx/docs/ReleaseNotes/21.rst (+1-1)
  • (modified) libcxx/include/future (-8)
  • (removed) libcxx/test/libcxx/thread/futures/futures.task/types.pass.cpp (-34)
  • (renamed) libcxx/test/std/thread/futures/futures.task/futures.task.members/type.verify.cpp (+4-10)
diff --git a/libcxx/docs/ReleaseNotes/21.rst b/libcxx/docs/ReleaseNotes/21.rst
index 2cb560b3852f3..30c2159304b03 100644
--- a/libcxx/docs/ReleaseNotes/21.rst
+++ b/libcxx/docs/ReleaseNotes/21.rst
@@ -98,7 +98,7 @@ Deprecations and Removals
 - libc++ no longer adds ``constexpr`` to ``std::hash<std::vector<bool, A>>::operator()``, as the ``constexpr`` addition
   since C++20 was an unintended extension.
 
-- TODO: The non-conforming extension ``packaged_task::result_type`` has been removed in LLVM 21.
+- The non-conforming extension ``packaged_task::result_type`` has been removed in LLVM 21.
 
 Potentially breaking changes
 ----------------------------
diff --git a/libcxx/include/future b/libcxx/include/future
index 31932aeeb6b82..abdd82dc95dd7 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -322,8 +322,6 @@ template <class R, class... ArgTypes>
 class packaged_task<R(ArgTypes...)>
 {
 public:
-    typedef R result_type; // extension
-
     // construction and destruction
     packaged_task() noexcept;
     template <class F>
@@ -1605,9 +1603,6 @@ inline _Rp __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes...
 
 template <class _Rp, class... _ArgTypes>
 class packaged_task<_Rp(_ArgTypes...)> {
-public:
-  using result_type _LIBCPP_DEPRECATED = _Rp; // extension
-
 private:
   __packaged_task_function<_Rp(_ArgTypes...)> __f_;
   promise<_Rp> __p_;
@@ -1699,9 +1694,6 @@ void packaged_task<_Rp(_ArgTypes...)>::reset() {
 
 template <class... _ArgTypes>
 class packaged_task<void(_ArgTypes...)> {
-public:
-  using result_type _LIBCPP_DEPRECATED = void; // extension
-
 private:
   __packaged_task_function<void(_ArgTypes...)> __f_;
   promise<void> __p_;
diff --git a/libcxx/test/libcxx/thread/futures/futures.task/types.pass.cpp b/libcxx/test/libcxx/thread/futures/futures.task/types.pass.cpp
deleted file mode 100644
index 659232caa46ec..0000000000000
--- a/libcxx/test/libcxx/thread/futures/futures.task/types.pass.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// UNSUPPORTED: no-threads
-// UNSUPPORTED: c++03
-
-// <future>
-
-// template<class R, class... ArgTypes>
-//     class packaged_task<R(ArgTypes...)>
-// {
-// public:
-//     typedef R result_type; // extension
-
-// This is a libc++ extension.
-
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
-
-#include <future>
-#include <type_traits>
-
-struct A {};
-
-int main(int, char**) {
-  static_assert((std::is_same<std::packaged_task<A(int, char)>::result_type, A>::value), "");
-  static_assert((std::is_same<std::packaged_task<void(int, char)>::result_type, void>::value), "");
-
-  return 0;
-}
diff --git a/libcxx/test/libcxx/thread/futures/futures.task/type.depr.verify.cpp b/libcxx/test/std/thread/futures/futures.task/futures.task.members/type.verify.cpp
similarity index 62%
rename from libcxx/test/libcxx/thread/futures/futures.task/type.depr.verify.cpp
rename to libcxx/test/std/thread/futures/futures.task/futures.task.members/type.verify.cpp
index 4065637e9eb2a..72171c99a6122 100644
--- a/libcxx/test/libcxx/thread/futures/futures.task/type.depr.verify.cpp
+++ b/libcxx/test/std/thread/futures/futures.task/futures.task.members/type.verify.cpp
@@ -11,18 +11,12 @@
 
 // <future>
 
-// template<class R, class... ArgTypes>
-//     class packaged_task<R(ArgTypes...)>
-// {
-// public:
-//     typedef R result_type; // extension
-
-// This libc++ extension is deprecated. See https://github.com/llvm/llvm-project/issues/112856.
+// Verify that the non-conforming extension packaged_task::result_type is removed.
+// See https://github.com/llvm/llvm-project/issues/112856.
 
 #include <future>
-#include <type_traits>
 
 struct A {};
 
-using RA = std::packaged_task<A(int, char)>::result_type;    // expected-warning {{'result_type' is deprecated}}
-using RV = std::packaged_task<void(int, char)>::result_type; // expected-warning {{'result_type' is deprecated}}
+using RA = std::packaged_task<A(int, char)>::result_type;    // expected-error {{no type named 'result_type'}}
+using RV = std::packaged_task<void(int, char)>::result_type; // expected-error {{no type named 'result_type'}}

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup!

@frederick-vs-ja frederick-vs-ja merged commit 8b171a0 into llvm:main Jul 10, 2025
146 of 151 checks passed
@frederick-vs-ja frederick-vs-ja deleted the remove-packaged_task-result_type branch July 10, 2025 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[libc++] Questionable extension packaged_task::result_type

3 participants